In recent years, an image coding method utilizing orthogonal transform, such as discrete cosine transform (DCT), and variable length coding, such as Huffman coding, is well known. The MPEG (Moving Picture Experts Group) system is typical of the image coding method.
An example of a conventional image encoder utilizing orthogonal transform and variable length coding is illustrated in FIG. 8. Hereinafter, a coding method according to the MPEG system will he described with reference to FIG. 8.
In FIG. 8, reference numeral 11 designates a block converter for dividing a digital video signal 18 into blocks for a Y signal, an R-Y signal, and a B-Y signal. Each block has a size of 8.times.8 pixels. Reference numeral 12 designates an orthogonal transformer for orthogonally transforming a digital video signal 20 divided into the blocks, for each block, to produce orthogonal transform coefficients 128. Reference numeral 13 designates a quantizer for quantizing the orthogonal transform coefficients 128. The quantization is performed by dividing the orthogonal transform coefficients 128 using 8.times.8 quantization matrices (not shown) corresponding to the respective frequencies after the orthogonal transformation and a quantization scale 168 decided by a quantization scale decision circuit 16. Reference numeral 14 designates a variable length encoder that performs variable length coding for the quantized orthogonal transform coefficients 138 with a macroblock MB as a unit and produces a code sequence 19. Reference numeral 17 designates a generated code length counter that receives a code length signal 148 output from the variable length encoder 14, accumulatively counts the code length, and detects a generated code length. Reference numeral 16 designates a quantization scale decision circuit for deciding a quantization scale 168 for the quantization of the orthogonal transform coefficients 138 in the quantizer 13, on the basis of an output 178 from the generator code length counter 17.
A description is given of the operation of the conventional color image encoder with reference to FIGS. 2, 8, 9, and 10.
As illustrated in FIG. 9, the digital video signal 18 is divided into a plurality of macroblocks, each having a size of 16.times.16 pixels, by the block converter 11 and, thereafter, each macroblock is converted to blocks for the Y signal, the R-Y signal, and the B-Y signal, each block having a size of 8.times.8 pixels. FIG. 2 shows components of the video signal which is converted to blocks by the block converter 11. In FIG. 2, Y1, Cr1, and Cb1 denote blocks of the Y, R-Y, and B-Y signals, respectively, included in a range of 16.times.16 pixels of the Y signal. The blocks Y1, Cr1, and Cb1 comprise, with 8.times.8 pixels as a unit block, 4 blocks (=2.times.2), 2 blocks (=2.times.1), and 2 blocks (=2.times.1), respectively. A macroblock MB is composed of these blocks Y1, Cr1, and Cb1.
Turning to FIG. 8, the digital video signal 20 converted to the blocks is subjected to orthogonal transform for each block by the orthogonal transformer 12, resulting in orthogonal transform coefficients 128 (refer to FIG. 9). The orthogonal transform coefficients 128 are quantized by the quantizer 13 (refer to FIG. 9). This quantization is performed by dividing the orthogonal transform coefficients 128 with values obtained by multiplying 8.times.8 quantization matrices (not shown) corresponding to the respective frequencies after the orthogonal transformation by a quantization scale 168 decided by the quantization scale decision circuit 16. Different quantization matrices are used for the luminance signal (Y signal) and the chrominance signals (R-Y and R-B signals) whereas the same quantization scale 168 is used for all the blocks in the macroblock. The quantized orthogonal transform coefficients 138 are subjected to variable length coding by the variable length encoder 14, resulting in a code sequence 19. The generator code length counter 17 counts the code length 148 generated in the variable length encoder 14. In case of MPEG, the code length is counted for each macroblock in one frame, and an accumulated code length in the frame (in FIG. 10(a), B.sub.N for the macroblock number N) is obtained. Receiving the accumulated code length 178 from the generator code length counter 17, the quantization scale decision circuit 16 decides a quantization scale 168 (in FIG. 10(a), Q.sub.N+1 for B.sub.N) so that the generated code length takes a prescribed value. As a unit for which the generated code length is made constant, one frame or one frame to several frames is selected.
In the conventional color image encoder as shown in FIG. 8, a quantization scale of a block to be encoded is decided on the basis of a code length which have been obtained previously. Therefore, the quantization is performed regardless of man's visual properties. Although man's visual sensation is sensitive to red color, since the same quantization distortion occurs for every color in the conventional device, deterioration due to the quantization distortion is more conspicuous in a red part than in parts of other colors.
In order to solve this problem, Japanese Published Patent Application No. Hei. 6-225340 proposed a method of prohibiting or reducing an increase in the quantization scale when a color in or near its saturation state is included. That is, when a color in or near its saturation state is included, even a little deterioration is conspicuous. So, the quantization scale is made small, whereby the deterioration is prevented. In this method, however, it is impossible to prevent deteriorations of cyan and yellow which are in opposite phases to red and blue.
Further, this publication proposed a method of making the quantization scale small when a saturation level is detected for a specified color, for example, violet. In this method, however, in order to judge if the specified color has reached the saturation level, various threshold values for the R-Y and B-Y signals must be set to detect the specified color, so that the setting of the threshold values is significantly complicated.